package net.sareweb.acab.session;

import net.sareweb.acab.entity.*;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityQuery;
import java.util.Arrays;

@Name("requestList")
public class RequestList extends EntityQuery<Request> {

	private static final String EJBQL = "select request from Request request";

	private static final String[] RESTRICTIONS = {
			"lower(request.name) like lower(concat(#{requestList.request.name},'%'))",
			"lower(request.cronExpression) like lower(concat(#{requestList.request.cronExpression},'%'))", };

	private Request request = new Request();

	public RequestList() {
		setEjbql(EJBQL);
		setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
		setMaxResults(25);
	}

	public Request getRequest() {
		return request;
	}
}
